package videosearch;

import java.util.ArrayList;

// Pair class to help encapsulate data for matches
class Pair {
    // index of best frame, min value of that match, filename of this video
    ArrayList<Double> data;
    String fileName;
    double min;
    int index;

    // constructor takes the data of the query matches and filename
    public Pair(String file, ArrayList<Double> matches) {
        data = matches;
        fileName = file;
        findMin(matches); // find the min and index of that min from the matches
    }

    // function to find the minimum value (best match) and its index frame
    void findMin(ArrayList<Double> data) {
        double m = Double.MAX_VALUE;
        int ind = 0;
        for (int i = 0; i < data.size(); i++) {
            double temp = data.get(i);

            if (temp < m) {
                m = temp;
                ind = i;
            }
        }

        min = m;
        index = ind;
    }
}